home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / layout / nsIFrame.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  63KB  |  1,519 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #ifndef nsIFrame_h___
  39. #define nsIFrame_h___
  40.  
  41. /* nsIFrame is in the process of being deCOMtaminated, i.e., this file is eventually
  42.    going to be eliminated, and all callers will use nsFrame instead.  At the moment
  43.    we're midway through this process, so you will see inlined functions and member
  44.    variables in this file.  -dwh */
  45.  
  46. #include <stdio.h>
  47. #include "nsISupports.h"
  48. #include "nsEvent.h"
  49. #include "nsStyleStruct.h"
  50. #include "nsStyleContext.h"
  51. #include "nsIContent.h"
  52. #include "nsHTMLReflowMetrics.h"
  53.  
  54. /**
  55.  * New rules of reflow:
  56.  * 1. you get a WillReflow() followed by a Reflow() followed by a DidReflow() in order
  57.  *    (no separate pass over the tree)
  58.  * 2. it's the parent frame's responsibility to size/position the child's view (not
  59.  *    the child frame's responsibility as it is today) during reflow (and before
  60.  *    sending the DidReflow() notification)
  61.  * 3. positioning of child frames (and their views) is done on the way down the tree,
  62.  *    and sizing of child frames (and their views) on the way back up
  63.  * 4. if you move a frame (outside of the reflow process, or after reflowing it),
  64.  *    then you must make sure that its view (or its child frame's views) are re-positioned
  65.  *    as well. It's reasonable to not position the view until after all reflowing the
  66.  *    entire line, for example, but the frame should still be positioned and sized (and
  67.  *    the view sized) during the reflow (i.e., before sending the DidReflow() notification)
  68.  * 5. the view system handles moving of widgets, i.e., it's not our problem
  69.  */
  70.  
  71. struct nsHTMLReflowState;
  72. class nsHTMLReflowCommand;
  73.  
  74. class nsIAtom;
  75. class nsPresContext;
  76. class nsIPresShell;
  77. class nsIRenderingContext;
  78. class nsIView;
  79. class nsIWidget;
  80. class nsIDOMRange;
  81. class nsISelectionController;
  82. class nsBoxLayoutState;
  83. class nsIBoxLayout;
  84. #ifdef ACCESSIBILITY
  85. class nsIAccessible;
  86. #endif
  87.  
  88. struct nsPeekOffsetStruct;
  89. struct nsPoint;
  90. struct nsRect;
  91. struct nsSize;
  92. struct nsMargin;
  93.  
  94. typedef class nsIFrame nsIBox;
  95.  
  96. // IID for the nsIFrame interface 
  97. // 2fb5effc-5eeb-4ccb-b9fa-325f8642200f
  98. #define NS_IFRAME_IID \
  99. { 0x2fb5effc, 0x5eeb, 0x4ccb, \
  100.   { 0xb9, 0xfa, 0x32, 0x5f, 0x86, 0x42, 0x20, 0x0f } }
  101.  
  102. /**
  103.  * Indication of how the frame can be split. This is used when doing runaround
  104.  * of floats, and when pulling up child frames from a next-in-flow.
  105.  *
  106.  * The choices are splittable, not splittable at all, and splittable in
  107.  * a non-rectangular fashion. This last type only applies to block-level
  108.  * elements, and indicates whether splitting can be used when doing runaround.
  109.  * If you can split across page boundaries, but you expect each continuing
  110.  * frame to be the same width then return frSplittable and not
  111.  * frSplittableNonRectangular.
  112.  *
  113.  * @see #IsSplittable()
  114.  */
  115. typedef PRUint32 nsSplittableType;
  116.  
  117. #define NS_FRAME_NOT_SPLITTABLE             0   // Note: not a bit!
  118. #define NS_FRAME_SPLITTABLE                 0x1
  119. #define NS_FRAME_SPLITTABLE_NON_RECTANGULAR 0x3
  120.  
  121. #define NS_FRAME_IS_SPLITTABLE(type)\
  122.   (0 != ((type) & NS_FRAME_SPLITTABLE))
  123.  
  124. #define NS_FRAME_IS_NOT_SPLITTABLE(type)\
  125.   (0 == ((type) & NS_FRAME_SPLITTABLE))
  126.  
  127. //----------------------------------------------------------------------
  128.  
  129. /**
  130.  * Frame state bits. Any bits not listed here are reserved for future
  131.  * extensions, but must be stored by the frames.
  132.  */
  133. typedef PRUint32 nsFrameState;
  134.  
  135. #define NS_FRAME_IN_REFLOW                            0x00000001
  136.  
  137. // This bit is set when a frame is created. After it has been reflowed
  138. // once (during the DidReflow with a finished state) the bit is
  139. // cleared.
  140. #define NS_FRAME_FIRST_REFLOW                         0x00000002
  141.  
  142. // If this bit is set, then there is a child frame in the frame that
  143. // extends outside this frame's bounding box. The implication is that
  144. // the frame's rect does not completely cover its children and
  145. // therefore operations like rendering and hit testing (for example)
  146. // must operate differently.
  147. #define NS_FRAME_OUTSIDE_CHILDREN                     0x00000008
  148.  
  149. // If this bit is set, then a reference to the frame is being held
  150. // elsewhere.  The frame may want to send a notification when it is
  151. // destroyed to allow these references to be cleared.
  152. #define NS_FRAME_EXTERNAL_REFERENCE                   0x00000010
  153.  
  154. // If this bit is set, then the frame is a replaced element. For example,
  155. // a frame displaying an image
  156. #define NS_FRAME_REPLACED_ELEMENT                     0x00000020
  157.  
  158. // If this bit is set, then the frame corresponds to generated content
  159. #define NS_FRAME_GENERATED_CONTENT                    0x00000040
  160.  
  161. // If this bit is set, then the frame uses XUL flexible box layout
  162. // for its children.
  163. #define NS_FRAME_IS_BOX                               0x00000080
  164.  
  165. // If this bit is set, then the frame has been moved out of the flow,
  166. // e.g., it is absolutely positioned or floated
  167. #define NS_FRAME_OUT_OF_FLOW                          0x00000100
  168.  
  169. // If this bit is set, then the frame reflects content that may be selected
  170. #define NS_FRAME_SELECTED_CONTENT                     0x00000200
  171.  
  172. // If this bit is set, then the frame is dirty and needs to be reflowed.
  173. // This bit is set when the frame is first created
  174. #define NS_FRAME_IS_DIRTY                             0x00000400
  175.  
  176. // If this bit is set then the frame is unflowable.
  177. #define NS_FRAME_IS_UNFLOWABLE                        0x00000800
  178.  
  179. // If this bit is set, the frame has dirty children.
  180. #define NS_FRAME_HAS_DIRTY_CHILDREN                   0x00001000
  181.  
  182. // If this bit is set, the frame has an associated view
  183. #define NS_FRAME_HAS_VIEW                             0x00002000
  184.  
  185. // If this bit is set, the frame was created from anonymous content.
  186. #define NS_FRAME_INDEPENDENT_SELECTION                0x00004000
  187.  
  188. // If this bit is set, the frame is "special" (lame term, I know),
  189. // which means that it is part of the mangled frame hierarchy that
  190. // results when an inline has been split because of a nested block.
  191. #define NS_FRAME_IS_SPECIAL                           0x00008000
  192.  
  193. // If this bit is set, the frame doesn't allow ignorable whitespace as
  194. // children. For example, the whitespace between <table>\n<tr>\n<td>
  195. // will be excluded during the construction of children. 
  196. // The bit is set when the frame is first created and remain
  197. // unchanged during the life-time of the frame.
  198. #define NS_FRAME_EXCLUDE_IGNORABLE_WHITESPACE         0x00010000
  199.  
  200. #ifdef IBMBIDI
  201. // If this bit is set, the frame itself is a bidi continuation,
  202. // or is incomplete (its next sibling is a bidi continuation)
  203. #define NS_FRAME_IS_BIDI                              0x00020000
  204. #endif
  205.  
  206. // If this bit is set the frame has descendant with a view
  207. #define NS_FRAME_HAS_CHILD_WITH_VIEW                  0x00040000
  208.  
  209. // If this bit is set, then reflow may be dispatched from the current
  210. // frame instead of the root frame.
  211. #define NS_FRAME_REFLOW_ROOT                          0x00080000
  212.  
  213. // The lower 20 bits of the frame state word are reserved by this API.
  214. #define NS_FRAME_RESERVED                             0x000FFFFF
  215.  
  216. // The upper 12 bits of the frame state word are reserved for frame
  217. // implementations.
  218. #define NS_FRAME_IMPL_RESERVED                        0xFFF00000
  219.  
  220. // Box layout bits
  221. #define NS_STATE_IS_HORIZONTAL                        0x00400000
  222. #define NS_STATE_IS_DIRECTION_NORMAL                  0x80000000
  223.  
  224. //----------------------------------------------------------------------
  225.  
  226. enum nsFramePaintLayer {
  227.   eFramePaintLayer_Underlay = 1,
  228.   eFramePaintLayer_Content = 2,
  229.   eFramePaintLayer_Overlay = 4
  230. };
  231.  
  232. enum nsSelectionAmount {
  233.   eSelectCharacter = 0,
  234.   eSelectWord      = 1,
  235.   eSelectLine      = 2,  //previous drawn line in flow.
  236.   eSelectBeginLine = 3,
  237.   eSelectEndLine   = 4,
  238.   eSelectNoAmount  = 5,   //just bounce back current offset.
  239.   eSelectDir       = 6,   //select next/previous frame based on direction
  240.   eSelectParagraph = 7    //select a "paragraph"
  241. };
  242.  
  243. enum nsDirection {
  244.   eDirNext    = 0,
  245.   eDirPrevious= 1
  246. };
  247.  
  248. enum nsSpread {
  249.   eSpreadNone   = 0,
  250.   eSpreadAcross = 1,
  251.   eSpreadDown   = 2
  252. };
  253.  
  254. // Carried out margin flags
  255. #define NS_CARRIED_TOP_MARGIN_IS_AUTO    0x1
  256. #define NS_CARRIED_BOTTOM_MARGIN_IS_AUTO 0x2
  257.  
  258. //----------------------------------------------------------------------
  259.  
  260. // For HTML reflow we rename with the different paint layers are
  261. // actually used for.
  262. #define NS_FRAME_PAINT_LAYER_BACKGROUND eFramePaintLayer_Underlay
  263. #define NS_FRAME_PAINT_LAYER_FLOATS   eFramePaintLayer_Content
  264. #define NS_FRAME_PAINT_LAYER_FOREGROUND eFramePaintLayer_Overlay
  265. #define NS_FRAME_PAINT_LAYER_DEBUG      eFramePaintLayer_Overlay
  266. #define NS_FRAME_PAINT_LAYER_ALL                       \
  267.   (nsFramePaintLayer(NS_FRAME_PAINT_LAYER_BACKGROUND | \
  268.                      NS_FRAME_PAINT_LAYER_FLOATS     | \
  269.                      NS_FRAME_PAINT_LAYER_FOREGROUND))
  270.  
  271. /**
  272.  * Reflow status returned by the reflow methods.
  273.  *
  274.  * NS_FRAME_NOT_COMPLETE bit flag means the frame does not map all its
  275.  * content, and that the parent frame should create a continuing frame.
  276.  * If this bit isn't set it means the frame does map all its content.
  277.  *
  278.  * NS_FRAME_REFLOW_NEXTINFLOW bit flag means that the next-in-flow is
  279.  * dirty, and also needs to be reflowed. This status only makes sense
  280.  * for a frame that is not complete, i.e. you wouldn't set both
  281.  * NS_FRAME_COMPLETE and NS_FRAME_REFLOW_NEXTINFLOW
  282.  *
  283.  * The low 8 bits of the nsReflowStatus are reserved for future extensions;
  284.  * the remaining 24 bits are zero (and available for extensions; however
  285.  * API's that accept/return nsReflowStatus must not receive/return any
  286.  * extension bits).
  287.  *
  288.  * @see #Reflow()
  289.  */
  290. typedef PRUint32 nsReflowStatus;
  291.  
  292. #define NS_FRAME_COMPLETE          0            // Note: not a bit!
  293. #define NS_FRAME_NOT_COMPLETE      0x1
  294. #define NS_FRAME_REFLOW_NEXTINFLOW 0x2
  295.  
  296. #define NS_FRAME_IS_COMPLETE(status) \
  297.   (0 == ((status) & NS_FRAME_NOT_COMPLETE))
  298.  
  299. #define NS_FRAME_IS_NOT_COMPLETE(status) \
  300.   (0 != ((status) & NS_FRAME_NOT_COMPLETE))
  301.  
  302. // This macro tests to see if an nsReflowStatus is an error value
  303. // or just a regular return value
  304. #define NS_IS_REFLOW_ERROR(_status) (PRInt32(_status) < 0)
  305.  
  306. /**
  307.  * Extensions to the reflow status bits defined by nsIFrameReflow
  308.  */
  309.  
  310. // This bit is set, when a break is requested. This bit is orthogonal
  311. // to the nsIFrame::nsReflowStatus completion bits.
  312. #define NS_INLINE_BREAK              0x0100
  313.  
  314. // When a break is requested, this bit when set indicates that the
  315. // break should occur after the frame just reflowed; when the bit is
  316. // clear the break should occur before the frame just reflowed.
  317. #define NS_INLINE_BREAK_BEFORE       0x0000
  318. #define NS_INLINE_BREAK_AFTER        0x0200
  319.  
  320. // The type of break requested can be found in these bits.
  321. #define NS_INLINE_BREAK_TYPE_MASK    0xF000
  322.  
  323. //----------------------------------------
  324. // Macros that use those bits
  325.  
  326. #define NS_INLINE_IS_BREAK(_status) \
  327.   (0 != ((_status) & NS_INLINE_BREAK))
  328.  
  329. #define NS_INLINE_IS_BREAK_AFTER(_status) \
  330.   (0 != ((_status) & NS_INLINE_BREAK_AFTER))
  331.  
  332. #define NS_INLINE_IS_BREAK_BEFORE(_status) \
  333.   (NS_INLINE_BREAK == ((_status) & (NS_INLINE_BREAK|NS_INLINE_BREAK_AFTER)))
  334.  
  335. #define NS_INLINE_GET_BREAK_TYPE(_status) (((_status) >> 12) & 0xF)
  336.  
  337. #define NS_INLINE_MAKE_BREAK_TYPE(_type)  ((_type) << 12)
  338.  
  339. // Construct a line-break-before status. Note that there is no
  340. // completion status for a line-break before because we *know* that
  341. // the frame will be reflowed later and hence it's current completion
  342. // status doesn't matter.
  343. #define NS_INLINE_LINE_BREAK_BEFORE()                                   \
  344.   (NS_INLINE_BREAK | NS_INLINE_BREAK_BEFORE |                           \
  345.    NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
  346.  
  347. // Take a completion status and add to it the desire to have a
  348. // line-break after. For this macro we do need the completion status
  349. // because the user of the status will need to know whether to
  350. // continue the frame or not.
  351. #define NS_INLINE_LINE_BREAK_AFTER(_completionStatus)                   \
  352.   ((_completionStatus) | NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |      \
  353.    NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
  354.  
  355. // The frame (not counting a continuation) did not fit in the available height and 
  356. // wasn't at the top of a page. If it was at the top of a page, then it is not 
  357. // possible to reflow it again with more height, so we don't set it in that case.
  358. #define NS_FRAME_TRUNCATED  0x0010
  359. #define NS_FRAME_IS_TRUNCATED(status) \
  360.   (0 != ((status) & NS_FRAME_TRUNCATED))
  361. #define NS_FRAME_SET_TRUNCATION(status, aReflowState, aMetrics) \
  362.   if (!aReflowState.mFlags.mIsTopOfPage &&                      \
  363.       aReflowState.availableHeight < aMetrics.height)           \
  364.     status |= NS_FRAME_TRUNCATED;                               \
  365.   else                                                          \
  366.     status &= ~NS_FRAME_TRUNCATED;
  367.  
  368. //----------------------------------------------------------------------
  369.  
  370. /**
  371.  * DidReflow status values.
  372.  */
  373. typedef PRBool nsDidReflowStatus;
  374.  
  375. #define NS_FRAME_REFLOW_NOT_FINISHED PR_FALSE
  376. #define NS_FRAME_REFLOW_FINISHED     PR_TRUE
  377.  
  378. //----------------------------------------------------------------------
  379.  
  380. /**
  381.  * A frame in the layout model. This interface is supported by all frame
  382.  * objects.
  383.  *
  384.  * Frames can have multiple child lists: the default unnamed child list
  385.  * (referred to as the <i>principal</i> child list, and additional named
  386.  * child lists. There is an ordering of frames within a child list, but
  387.  * there is no order defined between frames in different child lists of
  388.  * the same parent frame.
  389.  *
  390.  * Frames are NOT reference counted. Use the Destroy() member function
  391.  * to destroy a frame. The lifetime of the frame hierarchy is bounded by the
  392.  * lifetime of the presentation shell which owns the frames.
  393.  *
  394.  * nsIFrame is a private Gecko interface. If you are not Gecko then you
  395.  * should not use it. If you're not in layout, then you won't be able to
  396.  * link to many of the functions defined here. Too bad.
  397.  *
  398.  * If you're not in layout but you must call functions in here, at least
  399.  * restrict yourself to calling virtual methods, which won't hurt you as badly.
  400.  */
  401. class nsIFrame : public nsISupports
  402. {
  403. public:
  404.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAME_IID)
  405.  
  406.   nsPresContext* GetPresContext() const {
  407.     return GetStyleContext()->GetRuleNode()->GetPresContext();
  408.   }
  409.  
  410.   /**
  411.    * Called to initialize the frame. This is called immediately after creating
  412.    * the frame.
  413.    *
  414.    * If the frame is a continuing frame, then aPrevInFlow indicates the previous
  415.    * frame (the frame that was split). You should connect the continuing frame to
  416.    * its prev-in-flow, e.g. by using the AppendToFlow() function
  417.    *
  418.    * If you want a view associated with your frame, you should create the view
  419.    * now.
  420.    *
  421.    * @param   aContent the content object associated with the frame
  422.    * @param   aGeometricParent  the geometric parent frame
  423.    * @param   aContentParent  the content parent frame
  424.    * @param   aContext the style context associated with the frame
  425.    * @param   aPrevInFlow the prev-in-flow frame
  426.    * @see #AppendToFlow()
  427.    */
  428.   NS_IMETHOD  Init(nsPresContext*  aPresContext,
  429.                    nsIContent*      aContent,
  430.                    nsIFrame*        aParent,
  431.                    nsStyleContext*  aContext,
  432.                    nsIFrame*        aPrevInFlow) = 0;
  433.  
  434.   /**
  435.    * Destroys this frame and each of its child frames (recursively calls
  436.    * Destroy() for each child)
  437.    */
  438.   NS_IMETHOD  Destroy(nsPresContext* aPresContext) = 0;
  439.  
  440.   /*
  441.    * Notify the frame that it has been removed as the primary frame for its content
  442.    */
  443.   virtual void RemovedAsPrimaryFrame(nsPresContext* aPresContext) {}
  444.  
  445.   /**
  446.    * Called to set the initial list of frames. This happens after the frame
  447.    * has been initialized.
  448.    *
  449.    * This is only called once for a given child list, and won't be called
  450.    * at all for child lists with no initial list of frames.
  451.    *
  452.    * @param   aListName the name of the child list. A NULL pointer for the atom
  453.    *            name means the unnamed principal child list
  454.    * @param   aChildList list of child frames. Each of the frames has its
  455.    *            NS_FRAME_IS_DIRTY bit set
  456.    * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified
  457.    *            name,
  458.    *          NS_ERROR_UNEXPECTED if the frame is an atomic frame or if the
  459.    *            initial list of frames has already been set for that child list,
  460.    *          NS_OK otherwise
  461.    * @see     #Init()
  462.    */
  463.   NS_IMETHOD  SetInitialChildList(nsPresContext* aPresContext,
  464.                                   nsIAtom*        aListName,
  465.                                   nsIFrame*       aChildList) = 0;
  466.  
  467.   /**
  468.    * This method is responsible for appending frames to the frame
  469.    * list.  The implementation should append the frames to the specified
  470.    * child list and then generate a reflow command.
  471.    *
  472.    * @param   aListName the name of the child list. A NULL pointer for the atom
  473.    *            name means the unnamed principal child list
  474.    * @param   aFrameList list of child frames to append. Each of the frames has
  475.    *            its NS_FRAME_IS_DIRTY bit set
  476.    * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified
  477.    *            name,
  478.    *          NS_ERROR_UNEXPECTED if the frame is an atomic frame,
  479.    *          NS_OK otherwise
  480.    */
  481.   NS_IMETHOD AppendFrames(nsIAtom*        aListName,
  482.                           nsIFrame*       aFrameList) = 0;
  483.  
  484.   /**
  485.    * This method is responsible for inserting frames into the frame
  486.    * list.  The implementation should insert the new frames into the specified
  487.    * child list and then generate a reflow command.
  488.    *
  489.    * @param   aListName the name of the child list. A NULL pointer for the atom
  490.    *            name means the unnamed principal child list
  491.    * @param   aPrevFrame the frame to insert frames <b>after</b>
  492.    * @param   aFrameList list of child frames to insert <b>after</b> aPrevFrame.
  493.    *            Each of the frames has its NS_FRAME_IS_DIRTY bit set
  494.    * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified
  495.    *            name,
  496.    *          NS_ERROR_UNEXPECTED if the frame is an atomic frame,
  497.    *          NS_OK otherwise
  498.    */
  499.   NS_IMETHOD InsertFrames(nsIAtom*        aListName,
  500.                           nsIFrame*       aPrevFrame,
  501.                           nsIFrame*       aFrameList) = 0;
  502.  
  503.   /**
  504.    * This method is responsible for removing a frame in the frame
  505.    * list.  The implementation should do something with the removed frame
  506.    * and then generate a reflow command. The implementation is responsible
  507.    * for destroying aOldFrame (the caller mustn't destroy aOldFrame).
  508.    *
  509.    * @param   aListName the name of the child list. A NULL pointer for the atom
  510.    *            name means the unnamed principal child list
  511.    * @param   aOldFrame the frame to remove
  512.    * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified
  513.    *            name,
  514.    *          NS_ERROR_FAILURE if the child frame is not in the specified
  515.    *            child list,
  516.    *          NS_ERROR_UNEXPECTED if the frame is an atomic frame,
  517.    *          NS_OK otherwise
  518.    */
  519.   NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
  520.                          nsIFrame*       aOldFrame) = 0;
  521.  
  522.   /**
  523.    * This method is responsible for replacing the old frame with the
  524.    * new frame. The old frame should be destroyed and the new frame inserted
  525.    * in its place in the specified child list.
  526.    *
  527.    * @param   aListName the name of the child list. A NULL pointer for the atom
  528.    *            name means the unnamed principal child list
  529.    * @param   aOldFrame the frame to remove
  530.    * @param   aNewFrame the frame to replace it with. The new frame has its
  531.    *            NS_FRAME_IS_DIRTY bit set
  532.    * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified
  533.    *            name,
  534.    *          NS_ERROR_FAILURE if the old child frame is not in the specified
  535.    *            child list,
  536.    *          NS_ERROR_UNEXPECTED if the frame is an atomic frame,
  537.    *          NS_OK otherwise
  538.    */
  539.   NS_IMETHOD ReplaceFrame(nsIAtom*        aListName,
  540.                           nsIFrame*       aOldFrame,
  541.                           nsIFrame*       aNewFrame) = 0;
  542.  
  543.   /**
  544.    * Get the content object associated with this frame. Does not add a reference.
  545.    */
  546.   nsIContent* GetContent() const { return mContent; }
  547.  
  548.   /**
  549.    * Get the frame that should be the parent for the frames of child elements
  550.    */
  551.   virtual nsIFrame* GetContentInsertionFrame() { return this; }
  552.  
  553.   /**
  554.    * Get the child content node whose frame should be used as the parent for
  555.    * the frames of child elements.  A frame can implement this method, instead
  556.    * of GetContentInsertionFrame, if its insertion point corresponds to a
  557.    * content node, and the frame for that node is not constructed immediately
  558.    * when the frame is initialized.
  559.    */
  560.   virtual already_AddRefed<nsIContent> GetContentInsertionNode() { return nsnull; }
  561.  
  562.   /**
  563.    * Get the offsets of the frame. most will be 0,0
  564.    *
  565.    */
  566.   NS_IMETHOD GetOffsets(PRInt32 &start, PRInt32 &end) const = 0;
  567.  
  568.   /**
  569.    * Reset the offsets when splitting frames during Bidi reordering
  570.    *
  571.    */
  572.   virtual void AdjustOffsetsForBidi(PRInt32 aStart, PRInt32 aEnd) {}
  573.  
  574.   /**
  575.    * Get the style context associated with this frame.
  576.    *
  577.    */
  578.   nsStyleContext* GetStyleContext() const { return mStyleContext; }
  579.   void SetStyleContext(nsPresContext* aPresContext, nsStyleContext* aContext)
  580.   { 
  581.     if (aContext != mStyleContext) {
  582.       if (mStyleContext)
  583.         mStyleContext->Release();
  584.       mStyleContext = aContext;
  585.       if (aContext) {
  586.         aContext->AddRef();
  587.         DidSetStyleContext(aPresContext);
  588.       }
  589.     }
  590.   }
  591.  
  592.   // Style post processing hook
  593.   NS_IMETHOD DidSetStyleContext(nsPresContext* aPresContext) = 0;
  594.  
  595.   /**
  596.    * Get the style data associated with this frame.  This returns a
  597.    * const style struct pointer that should never be modified.  See
  598.    * |nsIStyleContext::GetStyleData| for more information.
  599.    *
  600.    * The use of the typesafe functions below is preferred to direct use
  601.    * of this function.
  602.    */
  603.   virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const = 0;
  604.  
  605.   const nsStyleStruct* GetStyleData(nsStyleStructID aSID) const {
  606. #ifdef _IMPL_NS_LAYOUT
  607.     NS_ASSERTION(mStyleContext, "No style context found!");
  608.     return mStyleContext->GetStyleData(aSID);
  609. #else
  610.     return GetStyleDataExternal(aSID);
  611. #endif
  612.   }
  613.  
  614.   /**
  615.    * Define typesafe getter functions for each style struct by
  616.    * preprocessing the list of style structs.  These functions are the
  617.    * preferred way to get style data.  The macro creates functions like:
  618.    *   const nsStyleBorder* GetStyleBorder();
  619.    *   const nsStyleColor* GetStyleColor();
  620.    */
  621.  
  622.   #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_)                      \
  623.     const nsStyle##name_ * GetStyle##name_() const {                          \
  624.       return NS_STATIC_CAST(const nsStyle##name_*,                            \
  625.                             GetStyleData(eStyleStruct_##name_));              \
  626.     }
  627.   #include "nsStyleStructList.h"
  628.   #undef STYLE_STRUCT
  629.  
  630.   // Utility function: more convenient than 2 calls to GetStyleData to get border and padding
  631.   
  632.   NS_IMETHOD  CalcBorderPadding(nsMargin& aBorderPadding) const = 0;
  633.  
  634.   /**
  635.    * These methods are to access any additional style contexts that
  636.    * the frame may be holding. These are contexts that are children
  637.    * of the frame's primary context and are NOT used as style contexts
  638.    * for any child frames. These contexts also MUST NOT have any child 
  639.    * contexts whatsoever. If you need to insert style contexts into the
  640.    * style tree, then you should create pseudo element frames to own them
  641.    * The indicies must be consecutive and implementations MUST return an 
  642.    * NS_ERROR_INVALID_ARG if asked for an index that is out of range.
  643.    */
  644.   virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const = 0;
  645.  
  646.   virtual void SetAdditionalStyleContext(PRInt32 aIndex,
  647.                                          nsStyleContext* aStyleContext) = 0;
  648.  
  649.   /**
  650.    * Accessor functions for geometric parent
  651.    */
  652.   nsIFrame* GetParent() const { return mParent; }
  653.   NS_IMETHOD SetParent(const nsIFrame* aParent) { mParent = (nsIFrame*)aParent; return NS_OK; }
  654.  
  655.   /**
  656.    * Bounding rect of the frame. The values are in twips, and the origin is
  657.    * relative to the upper-left of the geometric parent. The size includes the
  658.    * content area, borders, and padding.
  659.    *
  660.    * Note: moving or sizing the frame does not affect the view's size or
  661.    * position.
  662.    */
  663.   nsRect GetRect() const { return mRect; }
  664.   nsPoint GetPosition() const { return nsPoint(mRect.x, mRect.y); }
  665.   nsSize GetSize() const { return nsSize(mRect.width, mRect.height); }
  666.   void SetRect(const nsRect& aRect) { mRect = aRect; }
  667.   void SetPosition(const nsPoint& aPt) { mRect.MoveTo(aPt); }
  668.   void SetSize(const nsSize& aSize) { mRect.SizeTo(aSize); }
  669.  
  670.   /**
  671.    * Used to iterate the list of additional child list names. Returns the atom
  672.    * name for the additional child list at the specified 0-based index, or a
  673.    * NULL pointer if there are no more named child lists.
  674.    *
  675.    * Note that the list is only the additional named child lists and does not
  676.    * include the unnamed principal child list.
  677.    */
  678.   virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const = 0;
  679.  
  680.   /**
  681.    * Get the first child frame from the specified child list.
  682.    *
  683.    * @param   aListName the name of the child list. A NULL pointer for the atom
  684.    *            name means the unnamed principal child list
  685.    * @return  the child frame, or NULL if there is no such child
  686.    * @see     #GetAdditionalListName()
  687.    */
  688.   virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const = 0;
  689.  
  690.   /**
  691.    * Child frames are linked together in a singly-linked list
  692.    */
  693.   nsIFrame* GetNextSibling() const { return mNextSibling; }
  694.   void SetNextSibling(nsIFrame* aNextSibling) {
  695.     NS_ASSERTION(this != aNextSibling, "Creating a circular frame list, this is very bad."); 
  696.     mNextSibling = aNextSibling;
  697.   }
  698.  
  699.   /**
  700.    * Paint is responsible for painting the frame. The aWhichLayer
  701.    * argument indicates which layer of painting should be done during
  702.    * the call.
  703.    */
  704.   NS_IMETHOD  Paint(nsPresContext*      aPresContext,
  705.                     nsIRenderingContext& aRenderingContext,
  706.                     const nsRect&        aDirtyRect,
  707.                     nsFramePaintLayer    aWhichLayer,
  708.                     PRUint32             aFlags = 0) = 0;
  709.  
  710.   /**
  711.    * Does the frame paint its background? If not, then all or part of it will be
  712.    * painted by ancestors.
  713.    */
  714.   virtual PRBool CanPaintBackground() { return PR_TRUE; }
  715.  
  716.   /**
  717.    * Does this frame type always need a view?
  718.    */
  719.   virtual PRBool NeedsView() { return PR_FALSE; }
  720.  
  721.   /**
  722.    * This frame needs a view with a widget (e.g. because it's fixed
  723.    * positioned), so we call this to create the widget. If widgets for
  724.    * this frame type need to be of a certain type or require special
  725.    * initialization, that can be done here.
  726.    */
  727.   virtual nsresult CreateWidgetForView(nsIView* aView);
  728.  
  729.   /**
  730.    * Event handling of GUI events.
  731.    *
  732.    * @param   aEvent event structure describing the type of event and rge widget
  733.    *            where the event originated
  734.    *          The |point| member of this is in the coordinate system of the
  735.    *          view returned by GetOffsetFromView.
  736.    * @param   aEventStatus a return value indicating whether the event was handled
  737.    *            and whether default processing should be done
  738.    *
  739.    * XXX From a frame's perspective it's unclear what the effect of the event status
  740.    * is. Does it cause the event to continue propagating through the frame hierarchy
  741.    * or is it just returned to the widgets?
  742.    *
  743.    * @see     nsGUIEvent
  744.    * @see     nsEventStatus
  745.    */
  746.   NS_IMETHOD  HandleEvent(nsPresContext* aPresContext,
  747.                           nsGUIEvent*     aEvent,
  748.                           nsEventStatus*  aEventStatus) = 0;
  749.  
  750.   NS_IMETHOD  GetContentForEvent(nsPresContext* aPresContext,
  751.                                  nsEvent* aEvent,
  752.                                  nsIContent** aContent) = 0;
  753.  
  754.   NS_IMETHOD GetContentAndOffsetsFromPoint(nsPresContext* aCX,
  755.                                            const nsPoint&  aPoint,
  756.                                            nsIContent **   aNewContent,
  757.                                            PRInt32&        aContentOffset,
  758.                                            PRInt32&        aContentOffsetEnd,
  759.                                            PRBool&         aBeginFrameContent) = 0;
  760.  
  761.   /**
  762.    * This structure holds information about a cursor. mContainer represents a
  763.    * loaded image that should be preferred. If it is not possible to use it, or
  764.    * if it is null, mCursor should be used.
  765.    */
  766.   struct Cursor {
  767.     nsCOMPtr<imgIContainer> mContainer;
  768.     PRInt32                 mCursor;
  769.     PRBool                  mHaveHotspot;
  770.     float                   mHotspotX, mHotspotY;
  771.   };
  772.   /**
  773.    * Get the cursor for a given frame.
  774.    */
  775.   NS_IMETHOD  GetCursor(const nsPoint&  aPoint,
  776.                         Cursor&         aCursor) = 0;
  777.  
  778.   /**
  779.    * Get the frame that should receive events for a given point in the
  780.    * coordinate space of this frame's parent, if the frame is painted in
  781.    * the given paint layer.  A frame should return itself if it should
  782.    * recieve the events.  A successful return value indicates that a
  783.    * point was found.
  784.    */
  785.   NS_IMETHOD  GetFrameForPoint(const nsPoint& aPoint, 
  786.                                nsFramePaintLayer aWhichLayer,
  787.                                nsIFrame**     aFrame) = 0;
  788.   
  789.   
  790.   /**
  791.    * Get a point (in the frame's coordinate space) given an offset into
  792.    * the content. This point should be on the baseline of text with
  793.    * the correct horizontal offset
  794.    */
  795.   NS_IMETHOD  GetPointFromOffset(nsPresContext*          inPresContext,
  796.                                  nsIRenderingContext*     inRendContext,
  797.                                  PRInt32                  inOffset,
  798.                                  nsPoint*                 outPoint) = 0;
  799.   
  800.   /**
  801.    * Get the child frame of this frame which contains the given
  802.    * content offset. outChildFrame may be this frame, or nsnull on return.
  803.    * outContentOffset returns the content offset relative to the start
  804.    * of the returned node. You can also pass a hint which tells the method
  805.    * to stick to the end of the first found frame or the beginning of the 
  806.    * next in case the offset falls on a boundary.
  807.    */
  808.   NS_IMETHOD  GetChildFrameContainingOffset(PRInt32       inContentOffset,
  809.                                  PRBool                   inHint,//false stick left
  810.                                  PRInt32*                 outFrameContentOffset,
  811.                                  nsIFrame*                *outChildFrame) = 0;
  812.  
  813.  /**
  814.    * Get the current frame-state value for this frame. aResult is
  815.    * filled in with the state bits. 
  816.    */
  817.   nsFrameState GetStateBits() const { return mState; }
  818.  
  819.   /**
  820.    * Update the current frame-state value for this frame. 
  821.    */
  822.   void AddStateBits(nsFrameState aBits) { mState |= aBits; }
  823.   void RemoveStateBits(nsFrameState aBits) { mState &= ~aBits; }
  824.  
  825.   /**
  826.    * This call is invoked when content is changed in the content tree.
  827.    * The first frame that maps that content is asked to deal with the
  828.    * change by generating an incremental reflow command.
  829.    *
  830.    * @param aPresContext the presentation context
  831.    * @param aContent     the content node that was changed
  832.    * @param aAppend      a hint to the frame about the change
  833.    */
  834.   NS_IMETHOD  CharacterDataChanged(nsPresContext* aPresContext,
  835.                                    nsIContent*     aChild,
  836.                                    PRBool          aAppend) = 0;
  837.  
  838.   /**
  839.    * This call is invoked when the value of a content objects's attribute
  840.    * is changed. 
  841.    * The first frame that maps that content is asked to deal
  842.    * with the change by doing whatever is appropriate.
  843.    *
  844.    * @param aChild the piece of content whose attribute changed
  845.    * @param aNameSpaceID the namespace of the attribute
  846.    * @param aAttribute the atom name of the attribute
  847.    * @param aModType Whether or not the attribute was added, changed, or removed.
  848.    *   The constants are defined in nsIDOMMutationEvent.h.
  849.    */
  850.   NS_IMETHOD  AttributeChanged(nsIContent*     aChild,
  851.                                PRInt32         aNameSpaceID,
  852.                                nsIAtom*        aAttribute,
  853.                                PRInt32         aModType) = 0;
  854.  
  855.   /**
  856.    * Return how your frame can be split.
  857.    */
  858.   NS_IMETHOD  IsSplittable(nsSplittableType& aIsSplittable) const = 0;
  859.  
  860.   /**
  861.    * Flow member functions
  862.    */
  863.   virtual nsIFrame* GetPrevInFlow() const = 0;
  864.   NS_IMETHOD  SetPrevInFlow(nsIFrame*) = 0;
  865.   virtual nsIFrame* GetNextInFlow() const = 0;
  866.   NS_IMETHOD  SetNextInFlow(nsIFrame*) = 0;
  867.  
  868.   /**
  869.    * Return the first frame in our current flow. 
  870.    */
  871.   virtual nsIFrame* GetFirstInFlow() const {
  872.     return NS_CONST_CAST(nsIFrame*, this);
  873.   }
  874.  
  875.   /**
  876.    * Return the last frame in our current flow.
  877.    */
  878.   virtual nsIFrame* GetLastInFlow() const {
  879.     return NS_CONST_CAST(nsIFrame*, this);
  880.   }
  881.  
  882.   /**
  883.    * Pre-reflow hook. Before a frame is reflowed this method will be called.
  884.    * This call will always be invoked at least once before a subsequent Reflow
  885.    * and DidReflow call. It may be called more than once, In general you will
  886.    * receive on WillReflow notification before each Reflow request.
  887.    *
  888.    * XXX Is this really the semantics we want? Because we have the NS_FRAME_IN_REFLOW
  889.    * bit we can ensure we don't call it more than once...
  890.    */
  891.   NS_IMETHOD  WillReflow(nsPresContext* aPresContext) = 0;
  892.  
  893.   /**
  894.    * The frame is given a maximum size and asked for its desired size.
  895.    * This is the frame's opportunity to reflow its children.
  896.    *
  897.    * @param aDesiredSize <i>out</i> parameter where you should return the
  898.    *          desired size and ascent/descent info. You should include any
  899.    *          space you want for border/padding in the desired size you return.
  900.    *
  901.    *          It's okay to return a desired size that exceeds the max
  902.    *          size if that's the smallest you can be, i.e. it's your
  903.    *          minimum size.
  904.    *
  905.    *          maxElementSize is an optional parameter for returning your
  906.    *          maximum element size. If may be null in which case you
  907.    *          don't have to compute a maximum element size. The
  908.    *          maximum element size must be less than or equal to your
  909.    *          desired size.
  910.    *
  911.    *          For an incremental reflow you are responsible for invalidating
  912.    *          any area within your frame that needs repainting (including
  913.    *          borders). If your new desired size is different than your current
  914.    *          size, then your parent frame is responsible for making sure that
  915.    *          the difference between the two rects is repainted
  916.    *
  917.    * @param aReflowState information about your reflow including the reason
  918.    *          for the reflow and the available space in which to lay out. Each
  919.    *          dimension of the available space can either be constrained or
  920.    *          unconstrained (a value of NS_UNCONSTRAINEDSIZE). If constrained
  921.    *          you should choose a value that's less than or equal to the
  922.    *          constrained size. If unconstrained you can choose as
  923.    *          large a value as you like.
  924.    *
  925.    *          Note that the available space can be negative. In this case you
  926.    *          still must return an accurate desired size. If you're a container
  927.    *          you must <b>always</b> reflow at least one frame regardless of the
  928.    *          available space
  929.    *
  930.    * @param aStatus a return value indicating whether the frame is complete
  931.    *          and whether the next-in-flow is dirty and needs to be reflowed
  932.    */
  933.   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
  934.                     nsHTMLReflowMetrics&     aReflowMetrics,
  935.                     const nsHTMLReflowState& aReflowState,
  936.                     nsReflowStatus&          aStatus) = 0;
  937.  
  938.   /**
  939.    * Post-reflow hook. After a frame is reflowed this method will be called
  940.    * informing the frame that this reflow process is complete, and telling the
  941.    * frame the status returned by the Reflow member function.
  942.    *
  943.    * This call may be invoked many times, while NS_FRAME_IN_REFLOW is set, before
  944.    * it is finally called once with a NS_FRAME_REFLOW_COMPLETE value. When called
  945.    * with a NS_FRAME_REFLOW_COMPLETE value the NS_FRAME_IN_REFLOW bit in the
  946.    * frame state will be cleared.
  947.    *
  948.    * XXX This doesn't make sense. If the frame is reflowed but not complete, then
  949.    * the status should be NS_FRAME_NOT_COMPLETE and not NS_FRAME_COMPLETE
  950.    * XXX Don't we want the semantics to dictate that we only call this once for
  951.    * a given reflow?
  952.    */
  953.   NS_IMETHOD  DidReflow(nsPresContext*           aPresContext,
  954.                         const nsHTMLReflowState*  aReflowState,
  955.                         nsDidReflowStatus         aStatus) = 0;
  956.  
  957.   // XXX Maybe these three should be a separate interface?
  958.  
  959.   /**
  960.    * Helper method used by block reflow to identify runs of text so
  961.    * that proper word-breaking can be done.
  962.    *
  963.    * @param aContinueTextRun A frame should set aContinueTextRun to
  964.    *    PR_TRUE if we can continue a "text run" through the frame. A
  965.    *    text run is text that should be treated contiguously for line
  966.    *    and word breaking.
  967.    *
  968.    * @return The return value is irrelevant.
  969.    */
  970.   NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const = 0;
  971.  
  972.   // Justification helper method used to distribute extra space in a
  973.   // line to leaf frames. aUsedSpace is filled in with the amount of
  974.   // space actually used.
  975.   NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace) = 0;
  976.  
  977.   // Justification helper method that is used to remove trailing
  978.   // whitespace before justification.
  979.   NS_IMETHOD TrimTrailingWhiteSpace(nsPresContext* aPresContext,
  980.                                     nsIRenderingContext& aRC,
  981.                                     nscoord& aDeltaWidth,
  982.                                     PRBool& aLastCharIsJustifiable) = 0;
  983.  
  984.   /**
  985.    * Accessor functions to get/set the associated view object
  986.    *
  987.    * GetView returns non-null if and only if |HasView| returns true.
  988.    */
  989.   PRBool HasView() const { return mState & NS_FRAME_HAS_VIEW; }
  990.   nsIView* GetView() const;
  991.   virtual nsIView* GetViewExternal() const;
  992.   nsresult SetView(nsIView* aView);
  993.  
  994.   /**
  995.    * This view will be used to parent the views of any children.
  996.    * This allows us to insert an anonymous inner view to parent
  997.    * some children.
  998.    */
  999.   virtual nsIView* GetParentViewForChildFrame(nsIFrame* aFrame) const;
  1000.  
  1001.   /**
  1002.    * Find the closest view (on |this| or an ancestor).
  1003.    * If aOffset is non-null, it will be set to the offset of |this|
  1004.    * from the returned view.
  1005.    */
  1006.   nsIView* GetClosestView(nsPoint* aOffset = nsnull) const;
  1007.  
  1008.   /**
  1009.    * Find the closest ancestor (excluding |this| !) that has a view
  1010.    */
  1011.   nsIFrame* GetAncestorWithView() const;
  1012.   virtual nsIFrame* GetAncestorWithViewExternal() const;
  1013.  
  1014.   /**
  1015.    * Get the offset between the coordinate systems of |this| and aOther.
  1016.    * Adding the return value to a point in the coordinate system of |this|
  1017.    * will transform the point to the coordinate system of aOther.
  1018.    *
  1019.    * aOther must be non-null.
  1020.    * 
  1021.    * This function is fastest when aOther is an ancestor of |this|.
  1022.    *
  1023.    * NOTE: this actually returns the offset from aOther to |this|, but
  1024.    * that offset is added to transform _coordinates_ from |this| to
  1025.    * aOther.
  1026.    */
  1027.   nsPoint GetOffsetTo(const nsIFrame* aOther) const;
  1028.   virtual nsPoint GetOffsetToExternal(const nsIFrame* aOther) const;
  1029.  
  1030.   /**
  1031.    * Get the screen rect of the frame.
  1032.    * @return the pixel rect of the frame in screen coordinates.
  1033.    */
  1034.   nsIntRect GetScreenRect() const;
  1035.   virtual nsIntRect GetScreenRectExternal() const;
  1036.  
  1037.   /**
  1038.    * Returns the offset from this frame to the closest geometric parent that
  1039.    * has a view. Also returns the containing view or null in case of error
  1040.    */
  1041.   NS_IMETHOD  GetOffsetFromView(nsPoint&  aOffset,
  1042.                                 nsIView** aView) const = 0;
  1043.  
  1044.   /**
  1045.    * Returns the offset from this frame's upper left corner to the upper
  1046.    * left corner of the view returned by a call to GetView(). aOffset
  1047.    * will contain the offset to the view or (0,0) if the frame has no
  1048.    * view. aView will contain a pointer to the view returned by GetView().
  1049.    * aView is optional, that is, you may pass null if you are not interested
  1050.    * in getting a pointer to the view.
  1051.    */
  1052.   NS_IMETHOD  GetOriginToViewOffset(nsPoint&        aOffset,
  1053.                                     nsIView**       aView) const = 0;
  1054.  
  1055.   /**
  1056.    * Returns true if and only if all views, from |GetClosestView| up to
  1057.    * the top of the view hierarchy are visible.
  1058.    */
  1059.   virtual PRBool AreAncestorViewsVisible() const;
  1060.  
  1061.   /**
  1062.    * Returns the window that contains this frame. If this frame has a
  1063.    * view and the view has a window, then this frames window is
  1064.    * returned, otherwise this frame's geometric parent is checked
  1065.    * recursively upwards.
  1066.    * XXX virtual because gfx callers use it! (themes)
  1067.    */
  1068.   virtual nsIWidget* GetWindow() const;
  1069.  
  1070.   /**
  1071.    * Get the "type" of the frame. May return a NULL atom pointer
  1072.    *
  1073.    * @see nsLayoutAtoms
  1074.    */
  1075.   virtual nsIAtom* GetType() const = 0;
  1076.   
  1077.  
  1078.   /**
  1079.    * Bit-flags to pass to IsFrameOfType()
  1080.    */
  1081.   enum {
  1082.     eMathML =           1 << 0,
  1083.     eSVG =              1 << 1,
  1084.     eSVGForeignObject = 1 << 2
  1085.   };
  1086.  
  1087.   /**
  1088.    * API for doing a quick check if a frame is of a given
  1089.    * type. Returns true if the frame matches ALL flags passed in.
  1090.    */
  1091.   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
  1092.   {
  1093.     return !aFlags;
  1094.   }
  1095.  
  1096.   /**
  1097.    * Is this frame a containing block for non-positioned elements?
  1098.    */
  1099.   virtual PRBool IsContainingBlock() const = 0;
  1100.  
  1101.   /**
  1102.    * Is this frame a containing block for floating elements?
  1103.    * Note that very few frames are, so default to false.
  1104.    */
  1105.   virtual PRBool IsFloatContainingBlock() const { return PR_FALSE; }
  1106.  
  1107.   /**
  1108.    * Is this a leaf frame?  Frames that want the frame constructor to be able
  1109.    * to construct kids for them should return false, all others should return
  1110.    * true.  Note that returning true here does not mean that the frame _can't_
  1111.    * have kids.  It could still have kids created via
  1112.    * nsIAnonymousContentCreator.  Returning true indicates that "normal"
  1113.    * (non-anonymous, XBL-bound, CSS generated content, etc) children should not
  1114.    * be constructed.
  1115.    */
  1116.   virtual PRBool IsLeaf() const;
  1117.  
  1118.   /**
  1119.    * Does this frame want to capture the mouse when the user clicks in
  1120.    * it or its children? If so, return the view which should be
  1121.    * targeted for mouse capture. The view need not be this frame's view,
  1122.    * it could be the view on a child.
  1123.    */
  1124.   virtual nsIView* GetMouseCapturer() const { return nsnull; }
  1125.  
  1126.   /**
  1127.    * Invalidate part of the frame by asking the view manager to repaint.
  1128.    * aDamageRect is allowed to extend outside the frame's bounds. We'll do the right
  1129.    * thing. But it must be within the bounds of the view enclosing this frame.
  1130.    * We deliberately don't have an Invalidate() method that defaults to the frame's bounds.
  1131.    * We want all callers to *think* about what has changed in the frame and what area might
  1132.    * need to be repainted.
  1133.    *
  1134.    * @param aDamageRect is in the frame's local coordinate space
  1135.    */
  1136.   void Invalidate(const nsRect& aDamageRect, PRBool aImmediate = PR_FALSE) const;
  1137.  
  1138.   /**
  1139.    * Computes a rect that includes this frame, all its descendant
  1140.    * frames, this frame's outline (if any), and all descendant frames'
  1141.    * outlines (if any). This is the union of everything that might be painted by
  1142.    * this frame subtree.
  1143.    *
  1144.    * @return the rect relative to this frame's origin
  1145.    */
  1146.   nsRect GetOverflowRect() const;
  1147.  
  1148.   /**
  1149.    * Set/unset the NS_FRAME_OUTSIDE_CHILDREN flag and store the overflow area
  1150.    * as a frame property in the frame manager so that it can be retrieved
  1151.    * later without reflowing the frame.
  1152.    */
  1153.   void FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize);
  1154.  
  1155.   void FinishAndStoreOverflow(nsHTMLReflowMetrics* aMetrics) {
  1156.     FinishAndStoreOverflow(&aMetrics->mOverflowArea, nsSize(aMetrics->width, aMetrics->height));
  1157.   }
  1158.  
  1159.   /** Selection related calls
  1160.    */
  1161.   /** 
  1162.    *  Called to set the selection of the frame based on frame offsets.  you can FORCE the frame
  1163.    *  to redraw event if aSelected == the frame selection with the last parameter.
  1164.    *  data in struct may be changed when passed in.
  1165.    *  @param aRange is the range that will dictate if the frames need to be redrawn null means the whole content needs to be redrawn
  1166.    *  @param aSelected is it selected?
  1167.    *  @param aSpread should it spread the selection to flow elements around it? or go down to its children?
  1168.    */
  1169.   NS_IMETHOD  SetSelected(nsPresContext* aPresContext,
  1170.                           nsIDOMRange*    aRange,
  1171.                           PRBool          aSelected,
  1172.                           nsSpread        aSpread) = 0;
  1173.  
  1174.   NS_IMETHOD  GetSelected(PRBool *aSelected) const = 0;
  1175.  
  1176.   /**
  1177.    *  called to discover where this frame, or a parent frame has user-select style
  1178.    *  applied, which affects that way that it is selected.
  1179.    *    
  1180.    *  @param aIsSelectable out param. Set to true if the frame can be selected
  1181.    *                       (i.e. is not affected by user-select: none)
  1182.    *  @param aSelectStyle  out param. Returns the type of selection style found
  1183.    *                        (using values defined in nsStyleConsts.h).
  1184.    */
  1185.   NS_IMETHOD  IsSelectable(PRBool* aIsSelectable, PRUint8* aSelectStyle) const = 0;
  1186.  
  1187.   /** 
  1188.    *  Called to retrieve the SelectionController associated with the frame.
  1189.    *  @param aSelCon will contain the selection controller associated with
  1190.    *  the frame.
  1191.    */
  1192.   NS_IMETHOD  GetSelectionController(nsPresContext *aPresContext, nsISelectionController **aSelCon) = 0;
  1193.  
  1194.   /** EndSelection related calls
  1195.    */
  1196.  
  1197.   /**
  1198.    *  Call to turn on/off mouseCapture at the view level. Needed by the ESM so
  1199.    *  it must be in the public interface.
  1200.    *  @param aPresContext presContext associated with the frame
  1201.    *  @param aGrabMouseEvents PR_TRUE to enable capture, PR_FALSE to disable
  1202.    */
  1203.   NS_IMETHOD CaptureMouse(nsPresContext* aPresContext, PRBool aGrabMouseEvents) = 0;
  1204.  
  1205.   /**
  1206.    *  called to find the previous/next character, word, or line  returns the actual 
  1207.    *  nsIFrame and the frame offset.  THIS DOES NOT CHANGE SELECTION STATE
  1208.    *  uses frame's begin selection state to start. if no selection on this frame will 
  1209.    *  return NS_ERROR_FAILURE
  1210.    *  @param aPOS is defined in nsIFrameSelection
  1211.    */
  1212.   NS_IMETHOD  PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos) = 0;
  1213.  
  1214.   /**
  1215.    *  called to see if the children of the frame are visible from indexstart to index end.
  1216.    *  this does not change any state. returns PR_TRUE only if the indexes are valid and any of
  1217.    *  the children are visible.  for textframes this index is the character index.
  1218.    *  if aStart = aEnd result will be PR_FALSE
  1219.    *  @param aStart start index of first child from 0-N (number of children)
  1220.    *  @param aEnd   end index of last child from 0-N
  1221.    *  @param aRecurse should this frame talk to siblings to get to the contents other children?
  1222.    *  @param aFinished did this frame have the aEndIndex? or is there more work to do
  1223.    *  @param _retval  return value true or false. false = range is not rendered.
  1224.    */
  1225.   NS_IMETHOD CheckVisibility(nsPresContext* aContext, PRInt32 aStartIndex, PRInt32 aEndIndex, PRBool aRecurse, PRBool *aFinished, PRBool *_retval)=0;
  1226.  
  1227.   /**
  1228.    *  Called by a child frame on a parent frame to tell the parent frame that the child needs
  1229.    *  to be reflowed.  The parent should either propagate the request to its parent frame or 
  1230.    *  handle the request by generating a eReflowType_ReflowDirtyChildren reflow command.
  1231.    */
  1232.  
  1233.   NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) = 0;
  1234.  
  1235.   /**
  1236.    * Called to retrieve this frame's accessible.
  1237.    * If this frame implements Accessibility return a valid accessible
  1238.    * If not return NS_ERROR_NOT_IMPLEMENTED.
  1239.    * Note: nsAccessible must be refcountable. Do not implement directly on your frame
  1240.    * Use a mediatior of some kind.
  1241.    */
  1242. #ifdef ACCESSIBILITY
  1243.   NS_IMETHOD GetAccessible(nsIAccessible** aAccessible) = 0;
  1244. #endif
  1245.  
  1246.   /**
  1247.    * Get the frame whose style context should be the parent of this
  1248.    * frame's style context (i.e., provide the parent style context).
  1249.    * This frame must either be an ancestor of this frame or a child.  If
  1250.    * this frame returns a child frame, then the child frame must be sure
  1251.    * to return a grandparent or higher!
  1252.    *
  1253.    * @param aPresContext:   PresContext
  1254.    * @param aProviderFrame: The frame whose style context should be the
  1255.    *                        parent of this frame's style context.  Null
  1256.    *                        is permitted, and means that this frame's
  1257.    *                        style context should be the root of the
  1258.    *                        style context tree.
  1259.    * @param aIsChild:       True if |aProviderFrame| is set to a child
  1260.    *                        of this frame; false if it is an ancestor or
  1261.    *                        null.
  1262.    */
  1263.   NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
  1264.                                         nsIFrame**      aProviderFrame,
  1265.                                         PRBool*         aIsChild) = 0;
  1266.  
  1267.   /**
  1268.    * Determines whether a frame is visible for painting
  1269.    * this takes into account whether it is painting a selection or printing.
  1270.    * @param aPresContext PresContext
  1271.    * @param aRenderingContext PresContext
  1272.    * @param aCheckVis indicates whether it should check for CSS visibility, 
  1273.    *                  PR_FALSE skips the check, PR_TRUE does the check
  1274.    * @param aIsVisible return value
  1275.    */
  1276.   NS_IMETHOD IsVisibleForPainting(nsPresContext *     aPresContext, 
  1277.                                   nsIRenderingContext& aRenderingContext,
  1278.                                   PRBool               aCheckVis,
  1279.                                   PRBool*              aIsVisible) = 0;
  1280.  
  1281.   /**
  1282.    * Determine whether the frame is logically empty, which is roughly
  1283.    * whether the layout would be the same whether or not the frame is
  1284.    * present.  Placeholder frames should return true.  Block frames
  1285.    * should be considered empty whenever margins collapse through them,
  1286.    * even though those margins are relevant.  Text frames containing
  1287.    * only whitespace that does not contribute to the height of the line
  1288.    * should return true.
  1289.    */
  1290.   virtual PRBool IsEmpty() = 0;
  1291.  
  1292.   /**
  1293.    * Determine whether the frame is logically empty, assuming that all
  1294.    * its children are empty.
  1295.    */
  1296.   virtual PRBool IsSelfEmpty() = 0;
  1297.  
  1298.   /**
  1299.    * IsGeneratedContentFrame returns whether a frame corresponds to
  1300.    * generated content
  1301.    *
  1302.    * @return whether the frame correspods to generated content
  1303.    */
  1304.   PRBool IsGeneratedContentFrame() {
  1305.     return (mState & NS_FRAME_GENERATED_CONTENT) != 0;
  1306.   }
  1307.  
  1308.   /**
  1309.    * IsPseudoFrame returns whether a frame is a pseudo frame (eg an
  1310.    * anonymous table-row frame created for a CSS table-cell without an
  1311.    * enclosing table-row.
  1312.    *
  1313.    * @param aParentContent the content node corresponding to the parent frame
  1314.    * @return whether the frame is a pseudo frame
  1315.    */   
  1316.   PRBool IsPseudoFrame(nsIContent* aParentContent) {
  1317.     return mContent == aParentContent;
  1318.   }
  1319.  
  1320.  
  1321.   NS_HIDDEN_(void*) GetProperty(nsIAtom* aPropertyName,
  1322.                                 nsresult* aStatus = nsnull) const;
  1323.   virtual NS_HIDDEN_(void*) GetPropertyExternal(nsIAtom*  aPropertyName,
  1324.                                                 nsresult* aStatus) const;
  1325.   NS_HIDDEN_(nsresult) SetProperty(nsIAtom*           aPropertyName,
  1326.                                    void*              aValue,
  1327.                                    NSPropertyDtorFunc aDestructor = nsnull,
  1328.                                    void*              aDtorData = nsnull);
  1329.   NS_HIDDEN_(nsresult) DeleteProperty(nsIAtom* aPropertyName) const;
  1330.   NS_HIDDEN_(void*) UnsetProperty(nsIAtom* aPropertyName,
  1331.                                   nsresult* aStatus = nsnull) const;
  1332.  
  1333. #define NS_GET_BASE_LEVEL(frame) \
  1334. NS_PTR_TO_INT32(frame->GetProperty(nsLayoutAtoms::baseLevel))
  1335.  
  1336. #define NS_GET_EMBEDDING_LEVEL(frame) \
  1337. NS_PTR_TO_INT32(frame->GetProperty(nsLayoutAtoms::embeddingLevel))
  1338.  
  1339.   /** Create or retrieve the previously stored overflow area, if the frame does 
  1340.     * not overflow and no creation is required return nsnull.
  1341.     * @param aPresContext PresContext
  1342.     * @param aCreateIfNecessary  create a new nsRect for the overflow area
  1343.     * @return pointer to the overflow area rectangle 
  1344.     */
  1345.   nsRect* GetOverflowAreaProperty(PRBool aCreateIfNecessary = PR_FALSE);
  1346.  
  1347.   /**
  1348.    * Return PR_TRUE if and only if this frame obeys visibility:hidden.
  1349.    * if it does not, then nsContainerFrame will hide its view even though
  1350.    * this means children can't be made visible again.
  1351.    */
  1352.   virtual PRBool SupportsVisibilityHidden() { return PR_TRUE; }
  1353.  
  1354.   /**
  1355.    * Check if this frame is focusable and in the current tab order.
  1356.    * Tabbable is indicated by a nonnegative tabindex & is a subset of focusable.
  1357.    * For example, only the selected radio button in a group is in the 
  1358.    * tab order, unless the radio group has no selection in which case
  1359.    * all of the visible, non-disabled radio buttons in the group are 
  1360.    * in the tab order. On the other hand, all of the visible, non-disabled 
  1361.    * radio buttons are always focusable via clicking or script.
  1362.    * Also, depending on the pref accessibility.tabfocus some widgets may be 
  1363.    * focusable but removed from the tab order. This is the default on
  1364.    * Mac OS X, where fewer items are focusable.
  1365.    * @param  [in, optional] aTabIndex the computed tab index
  1366.    *         < 0 if not tabbable
  1367.    *         == 0 if in normal tab order
  1368.    *         > 0 can be tabbed to in the order specified by this value
  1369.    * @param  [in, optional] aWithMouse, is this focus query for mouse clicking
  1370.    * @return whether the frame is focusable via mouse, kbd or script.
  1371.    */
  1372.   virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull, PRBool aWithMouse = PR_FALSE);
  1373.  
  1374.   // BOX LAYOUT METHODS
  1375.   // These methods have been migrated from nsIBox and are in the process of
  1376.   // being refactored. DO NOT USE OUTSIDE OF XUL.
  1377.   PRBool IsBoxFrame() const { return (mState & NS_FRAME_IS_BOX) != 0; }
  1378.   PRBool IsBoxWrapped() const
  1379.   { return (!IsBoxFrame() && mParent && mParent->IsBoxFrame()); }
  1380.  
  1381.   enum Halignment {
  1382.     hAlign_Left,
  1383.     hAlign_Right,
  1384.     hAlign_Center
  1385.   };
  1386.  
  1387.   enum Valignment {
  1388.     vAlign_Top,
  1389.     vAlign_Middle,
  1390.     vAlign_BaseLine,
  1391.     vAlign_Bottom
  1392.   };
  1393.  
  1394.   NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)=0;
  1395.   NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)=0;
  1396.   NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)=0;
  1397.   NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex)=0;
  1398.   NS_HIDDEN_(nsresult)
  1399.     GetOrdinal(nsBoxLayoutState& aBoxLayoutState, PRUint32& aOrdinal);
  1400.  
  1401.   /**
  1402.    * This returns the minimum size for the scroll area if this frame is
  1403.    * being scrolled. Usually it's (0,0).
  1404.    */
  1405.   virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState) = 0;
  1406.  
  1407.   NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)=0;
  1408.   NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0;
  1409.   // This does not alter the overflow area. If the caller is changing
  1410.   // the box size, the caller is responsible for updating the overflow
  1411.   // area. It's enough to just call Layout or SyncLayout on the
  1412.   // box. You can pass PR_TRUE to aRemoveOverflowArea as a
  1413.   // convenience.
  1414.   NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
  1415.                        PRBool aRemoveOverflowArea = PR_FALSE)=0;
  1416.   NS_HIDDEN_(nsresult) Layout(nsBoxLayoutState& aBoxLayoutState);
  1417.   nsresult IsDirty(PRBool& aIsDirty) { aIsDirty = (mState & NS_FRAME_IS_DIRTY) != 0; return NS_OK; }
  1418.   nsresult HasDirtyChildren(PRBool& aIsDirty) { aIsDirty = (mState & NS_FRAME_HAS_DIRTY_CHILDREN) != 0; return NS_OK; }
  1419.   NS_IMETHOD MarkDirty(nsBoxLayoutState& aState)=0;
  1420.   NS_HIDDEN_(nsresult) MarkDirtyChildren(nsBoxLayoutState& aState);
  1421.   nsresult GetChildBox(nsIBox** aBox)
  1422.   {
  1423.     // box layout ends at box-wrapped frames, so don't allow these frames
  1424.     // to report child boxes.
  1425.     *aBox = IsBoxFrame() ? GetFirstChild(nsnull) : nsnull;
  1426.     return NS_OK;
  1427.   }
  1428.   nsresult GetNextBox(nsIBox** aBox)
  1429.   {
  1430.     *aBox = (mParent && mParent->IsBoxFrame()) ? mNextSibling : nsnull;
  1431.     return NS_OK;
  1432.   }
  1433.   NS_HIDDEN_(nsresult) GetParentBox(nsIBox** aParent);
  1434.   // Box methods.  Note that these do NOT just get the CSS border, padding,
  1435.   // etc.  They also talk to nsITheme.
  1436.   NS_IMETHOD GetBorderAndPadding(nsMargin& aBorderAndPadding);
  1437.   NS_IMETHOD GetBorder(nsMargin& aBorder)=0;
  1438.   NS_IMETHOD GetPadding(nsMargin& aBorderAndPadding)=0;
  1439. #ifdef DEBUG_LAYOUT
  1440.   NS_IMETHOD GetInset(nsMargin& aInset)=0;
  1441. #else
  1442.   nsresult GetInset(nsMargin& aInset) { aInset.SizeTo(0, 0, 0, 0); return NS_OK; }
  1443. #endif
  1444.   NS_IMETHOD GetMargin(nsMargin& aMargin)=0;
  1445.   NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout)=0;
  1446.   NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout)=0;
  1447.   NS_HIDDEN_(nsresult) GetContentRect(nsRect& aContentRect);
  1448.   NS_HIDDEN_(nsresult) GetClientRect(nsRect& aContentRect);
  1449.   NS_IMETHOD GetVAlign(Valignment& aAlign) = 0;
  1450.   NS_IMETHOD GetHAlign(Halignment& aAlign) = 0;
  1451.  
  1452.   PRBool IsHorizontal() const { return (mState & NS_STATE_IS_HORIZONTAL) != 0; }
  1453.   nsresult GetOrientation(PRBool& aIsHorizontal)  /// XXX to be removed
  1454.   { aIsHorizontal = IsHorizontal(); return NS_OK; }
  1455.  
  1456.   PRBool IsNormalDirection() const { return (mState & NS_STATE_IS_DIRECTION_NORMAL) != 0; }
  1457.   nsresult GetDirection(PRBool& aIsNormal)  /// XXX to be removed
  1458.   { aIsNormal = IsNormalDirection(); return NS_OK; }
  1459.  
  1460.   NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE);
  1461.   NS_IMETHOD NeedsRecalc()=0;
  1462.   NS_IMETHOD RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild)=0;
  1463.   NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)=0;
  1464.   NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough)=0;
  1465.   NS_IMETHOD MarkChildrenStyleChange()=0;
  1466.   NS_IMETHOD MarkStyleChange(nsBoxLayoutState& aState)=0;
  1467.   NS_IMETHOD SetIncludeOverflow(PRBool aInclude) = 0;
  1468.   NS_IMETHOD GetOverflow(nsSize& aOverflow) = 0;
  1469.  
  1470. #ifdef DEBUG_LAYOUT
  1471.   NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug)=0;
  1472.   NS_IMETHOD GetDebug(PRBool& aDebug)=0;
  1473.   NS_IMETHOD GetDebugBoxAt(const nsPoint& aPoint, nsIBox** aBox)=0;
  1474.  
  1475.   NS_IMETHOD DumpBox(FILE* out)=0;
  1476. #endif
  1477.   NS_IMETHOD ChildrenMustHaveWidgets(PRBool& aMust) const=0;
  1478.   NS_IMETHOD GetIndexOf(nsIBox* aChild, PRInt32* aIndex)=0;
  1479.  
  1480.   static PRBool AddCSSPrefSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize);
  1481.   static PRBool AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize);
  1482.   static PRBool AddCSSMaxSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize);
  1483.   static PRBool AddCSSFlex(nsBoxLayoutState& aState, nsIBox* aBox, nscoord& aFlex);
  1484.   static PRBool AddCSSCollapsed(nsBoxLayoutState& aState, nsIBox* aBox, PRBool& aCollapsed);
  1485.   static PRBool AddCSSOrdinal(nsBoxLayoutState& aState, nsIBox* aBox, PRUint32& aOrdinal);
  1486.  
  1487.   // END OF BOX LAYOUT METHODS
  1488.   // The above methods have been migrated from nsIBox and are in the process of
  1489.   // being refactored. DO NOT USE OUTSIDE OF XUL.
  1490.  
  1491.   /**
  1492.    * gets the first or last possible caret position within the frame
  1493.    *
  1494.    * @param  [in] aStart
  1495.    *         true  for getting the first possible caret position
  1496.    *         false for getting the last possible caret position
  1497.    * @return The caret position in an nsPeekOffsetStruct (the
  1498.    *         fields set are mResultContent and mContentOffset;
  1499.    *         the returned value is a 'best effort' in case errors
  1500.    *         are encountered rummaging through the frame.
  1501.    */
  1502.   nsPeekOffsetStruct GetExtremeCaretPosition(PRBool aStart);
  1503.  
  1504. protected:
  1505.   // Members
  1506.   nsRect           mRect;
  1507.   nsIContent*      mContent;
  1508.   nsStyleContext*  mStyleContext;
  1509.   nsIFrame*        mParent;
  1510.   nsIFrame*        mNextSibling;  // singly-linked list of frames
  1511.   nsFrameState     mState;
  1512.  
  1513. private:
  1514.   NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
  1515.   NS_IMETHOD_(nsrefcnt) Release(void) = 0;
  1516. };
  1517.  
  1518. #endif /* nsIFrame_h___ */
  1519.